

find_package( Ogre COMPONENTS OgreMain OgrePaging REQUIRED)
include_directories(${Ogre_INCLUDE_DIRS})
link_directories(${Ogre_LIBRARY_DIRS})

find_package( Bullet COMPONENTS BulletCollision BulletDynamics LinearMath REQUIRED )
include_directories(${Bullet_INCLUDE_DIRS})
link_directories(${Bullet_LIBRARY_DIRS})

find_package( OgreBullet COMPONENTS Collisions Dynamics REQUIRED )
include_directories(${OgreBullet_INCLUDE_DIRS})
link_directories(${OgreBullet_LIBRARY_DIRS})

add_executable( OpenFms WIN32 
	OpenFms.cpp 
	#FmsVehicle.cpp
	OfmsSimpleCar.h
	OfmsSimpleCar.cpp
	${CMAKE_SOURCE_DIR}/src/OfmsMath.h
	${CMAKE_SOURCE_DIR}/src/OfmsMath.cpp
	${CMAKE_SOURCE_DIR}/src/ModelSimulator.h
	${CMAKE_SOURCE_DIR}/src/ModelSimulator.cpp
	${CMAKE_SOURCE_DIR}/src/InputDevice.h 
	${CMAKE_SOURCE_DIR}/src/InputDevice.cpp 
	${CMAKE_SOURCE_DIR}/src/BulletTickListener.h 
	${CMAKE_SOURCE_DIR}/src/BulletTickListener.cpp 
)

FOREACH( _lib ${Ogre_LIBRARIES})
  TARGET_LINK_LIBRARIES( OpenFms optimized "${_lib}"  )
ENDFOREACH()

FOREACH( _lib ${Ogre_LIBRARIES_DEBUG})
  TARGET_LINK_LIBRARIES( OpenFms debug "${_lib}"  )
ENDFOREACH()

FOREACH( _lib ${OgreBullet_LIBRARIES})
  TARGET_LINK_LIBRARIES( OpenFms optimized "${_lib}"  )
ENDFOREACH()

FOREACH( _lib ${OgreBullet_LIBRARIES_DEBUG})
  TARGET_LINK_LIBRARIES( OpenFms debug "${_lib}"  )
ENDFOREACH()

#TARGET_LINK_LIBRARIES( OpenFms optimized "${Ogre_LIBRARIES}"  )
#TARGET_LINK_LIBRARIES( OpenFms debug "${Ogre_LIBRARIES_DEBUG}"  )
TARGET_LINK_LIBRARIES( OpenFms ${Bullet_LIBRARIES}  )
#TARGET_LINK_LIBRARIES( OpenFms optimized ${OgreBullet_LIBRARIES}  )
#TARGET_LINK_LIBRARIES( OpenFms debug ${OgreBullet_LIBRARIES_DEBUG}  )


# TODO: allow this, instead of copying the file s in ConfigureOgre.cmake
#add_dependencies(OpenFms ${EXECUTABLE_OUTPUT_PATH}/Release/OgreMain.dll)

